import request from '@/utils/request'

/**
 * 获取商品列表
 */
export function getGoodsList(pageNo, size, storeId) {
    return request(({
        url: '/goods/goodsListPage',
        method: 'get',
        params: {pageNo: pageNo, size: size, storeId : storeId}
    }))
}

/**
 * 获取可上架商品列表
 */
export function getGoodsPage(pageNo, size, storeId) {
    return request(({
        url: '/goods/goodsPage',
        method: 'get',
        params: {pageNo: pageNo, size: size, storeId : storeId}
    }))
}


export function changeGoodsNum(goodsId, storeId, num, isAdd) {
    return request({
        url: '/goods/changeGoodsNum',
        method: 'POST',
        params: {goodsId: goodsId, storeId: storeId, num : num, isAdd: isAdd}
    })
}

export function goodsOffStore(goodsId, storeId) {
    return request({
        url: '/goods/goodsOff',
        method: 'delete',
        params: {goodsId: goodsId, storeId: storeId}
    })
}
export function goodsOnStore(goodsId, storeId, num) {
    return request({
        url: '/goods/goodsOn',
        method: 'post',
        params: {goodsId: goodsId, storeId: storeId, num: num}
    })
}


export function addGoods(goodsDTO,userId) {
    return request({
        url: '/goods/addGoodsByDTO?userId='+userId,
        method: 'POST',
        data: goodsDTO
    })
}

